/**
 * CopyRight (C) 2014 DBAppSecurity Inc., All Rights Reserved
 */
package com.monitor.distort.util;

import java.io.IOException;
import java.util.Properties;


/**
 * @Description: 监测参数配置信息
 * <p>
 *     (Change Log v1.1) 添加文件大小 
 * </p>
 * <p>
 *     <li>add maxHtmlFileSize</li>
 * </p>
 * <p>
 *     (Change Log v1.2) 添加结果存储路径、pantomjs路径
 * </p>
 * <p>
 *     <li>add storePath</li>
 *     <li>add phantomjsExecPath</li>
 * </p>
 * @author lijun.huang
 * @date 2014-2-28 下午12:09:02
 * @version 1.2
 *
 */
public class WgetConfig {
    /**
     * 监测网站的 上一次版本路径
     */
    public static String lastPath;

    /**
     * 监测网站的 基准版本路径
     */
    public static String basePath;

    /**
     * 监测网站的 最新版本路径
     */
    public static String newPath;
    
    /**
     * 结果存储路径
     */
    public static String storePath;
    
    /**
     * phantomjs执行路径
     */
    public static String phantomjsExecPath;
    
    /**
     * 比较网页的最大大小；单位（M）
     */
    public static Integer maxHtmlFileSize;
    
    /**
     * wget的个数上限
     */
    public static Integer wgetLimit;
    
    /**
     * 监测程序的个数上限
     */
    public static Integer distortProcessLimit;		
    
    /**
     * 监测程序文件名
     */
    public static String distortDetectName;
    
    /**
     * 监测程序所在路径
     */
    public static String distortDetectPath;
    
    /**
     * 网页列表文件路径名
     */
    public static String webUrlPath;

    static {
        Properties prop = new Properties();

        try {
            prop.load(WgetConfig.class.getClassLoader()
                                         .getResourceAsStream("config.properties"));
        } catch (IOException e) {
        	e.printStackTrace();
        }

        lastPath = prop.getProperty("lastPath", "/home/huanglj/monitor/last/");
        basePath = prop.getProperty("basePath", "/home/huanglj/monitor/base/");
        newPath = prop.getProperty("newPath", "/home/huanglj/monitor/new/");
        storePath = prop.getProperty("storePath", "/home/huanglj/monitor/store/");
        phantomjsExecPath = prop.getProperty("phantomjsExecPath", "/home/huanglj/monitor/phantomjs/");
        
        maxHtmlFileSize = Integer.parseInt( prop.getProperty("maxHtmlFileSize", "5") );
        
        wgetLimit = Integer.parseInt( prop.getProperty("wgetLimit", "15") );
        
        distortProcessLimit = Integer.parseInt( prop.getProperty("distortProcessLimit", "15") );
        
        distortDetectName = prop.getProperty("distortDetectName", "distortDetect.jar");
        
        distortDetectPath = prop.getProperty("distortDetectPath", "/home/huanglj/develop");
        
        webUrlPath = prop.getProperty("distortDetectPath", "/home/huanglj/develop");
    }

    public static void main(String[] args) {
    	System.out.println(WgetConfig.distortProcessLimit);
    }
}
